<script type="text/javascript">
    $().ready(function(){
        /**
         * Create the auto-complete form for TAGS
         *
         */
        function split(val) {
            return val.split(/,\s*/);
        }
        function extractLast(term) {
            return split(term).pop();
        }
        



        $("#user_profile_mapping_profileTextLookup").autocomplete({
            minLength: 2,
            source: function(request, response) {
                $.getJSON('<?php echo url_for('CollectionNameSearch') ?>', {
                    term: extractLast(request.term)
                }, response);
            },
            select: function(event, ui) {
                $(this).val(ui.item.label);
                $('#user_profile_mapping_collectionItemUin').val(ui.item.value);
                return false;

            }
        });


    });
</script>
<form action="<?php echo url_for('ProfileLinkUserProfile') ?>" method="post" >
    <table>
        <tr>
            <th>
                User
            </th>
            <td>
                <?php echo $form->getObject()->getSfGuardUser(); ?>
            </td>
        </tr>
        <?php echo $form->render(true); ?>

    </table>
    <input type="submit" value="Link Profile"/>
</form>
